/**
 * 
 */
package org.vsg.security.authz.permission.menu;

import org.jsecurity.authz.Permission;
import org.vsg.security.authz.permission.AbstractResourcePermission;
import org.vsg.security.model.domain.SysResource;

/**
 * @author Bill Vison
 *
 */
public class ACCESS extends AbstractResourcePermission {

	/* (non-Javadoc)
	 * argument permssion is validate from menu frame
	 * @see org.jsecurity.authz.Permission#implies(org.jsecurity.authz.Permission)
	 */
	@Override
	public boolean implies(Permission perm) {
		// TODO Auto-generated method stub
		AbstractResourcePermission resPerm = (AbstractResourcePermission)perm;
		
		SysResource res = resPerm.getResource();
		
		if ( this.getResource().getId() == res.getId() && 
				this.getClass().getName().equals(perm.getClass().getName())) {
			return true;
		}
		return false;
	}

}
